home *** CD-ROM | disk | FTP | other *** search
Wrap
unit Subscriber_TLB; // ************************************************************************ // // WARNING // ------- // The types declared in this file were generated from data read from a // Type Library. If this type library is explicitly or indirectly (via // another type library referring to this type library) re-imported, or the // 'Refresh' command of the Type Library Editor activated while editing the // Type Library, the contents of this file will be regenerated and all // manual modifications will be lost. // ************************************************************************ // // PASTLWTR : $Revision: 1.88 $ // File generated on 1/10/2000 7:29:20 PM from Type Library described below. // *************************************************************************// // NOTE: // Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties // which return objects that may need to be explicitly created via a function // call prior to any access via the property. These items have been disabled // in order to prevent accidental use from within the object inspector. You // may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively // removing them from the $IFDEF blocks. However, such items must still be // programmatically created via a method of the appropriate CoClass before // they can be used. // ************************************************************************ // // Type Lib: C:\My Documents\DelphiMag\Feb00\Events\Subscriber.tlb (1) // IID\LCID: {99E9A8B0-EF81-40E5-BDC2-08AD7F79D452}\0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb) // (2) v4.0 StdVCL, (C:\WINNT\System32\STDVCL40.DLL) // (3) v1.0 Publisher, (C:\My Documents\DelphiMag\Feb00\Events\Publisher.dll) // ************************************************************************ // {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. interface uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL, Publisher_TLB; // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: // Type Libraries : LIBID_xxxx // CoClasses : CLASS_xxxx // DISPInterfaces : DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const // TypeLibrary Major and minor versions SubscriberMajorVersion = 1; SubscriberMinorVersion = 0; LIBID_Subscriber: TGUID = '{99E9A8B0-EF81-40E5-BDC2-08AD7F79D452}'; IID_ISubObj: TGUID = '{058E8DFF-0AD5-410A-B891-2C51818D2032}'; CLASS_SubObj: TGUID = '{F57BF8DC-A3B4-4363-9049-4F058F3AE753}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// ISubObj = interface; ISubObjDisp = dispinterface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// SubObj = ISubObj; // *********************************************************************// // Interface: ISubObj // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {058E8DFF-0AD5-410A-B891-2C51818D2032} // *********************************************************************// ISubObj = interface(IDispatch) ['{058E8DFF-0AD5-410A-B891-2C51818D2032}'] end; // *********************************************************************// // DispIntf: ISubObjDisp // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {058E8DFF-0AD5-410A-B891-2C51818D2032} // *********************************************************************// ISubObjDisp = dispinterface ['{058E8DFF-0AD5-410A-B891-2C51818D2032}'] end; // *********************************************************************// // The Class CoSubObj provides a Create and CreateRemote method to // create instances of the default interface ISubObj exposed by // the CoClass SubObj. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoSubObj = class class function Create: ISubObj; class function CreateRemote(const MachineName: string): ISubObj; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TSubObj // Help String : SubObj Object // Default Interface: ISubObj // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TSubObjProperties= class; {$ENDIF} TSubObj = class(TOleServer) private FIntf: ISubObj; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TSubObjProperties; function GetServerProperties: TSubObjProperties; {$ENDIF} function GetDefaultInterface: ISubObj; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: ISubObj); procedure Disconnect; override; property DefaultInterface: ISubObj read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TSubObjProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TSubObj // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TSubObjProperties = class(TPersistent) private FServer: TSubObj; function GetDefaultInterface: ISubObj; constructor Create(AServer: TSubObj); protected public property DefaultInterface: ISubObj read GetDefaultInterface; published end; {$ENDIF} procedure Register; implementation uses ComObj; class function CoSubObj.Create: ISubObj; begin Result := CreateComObject(CLASS_SubObj) as ISubObj; end; class function CoSubObj.CreateRemote(const MachineName: string): ISubObj; begin Result := CreateRemoteComObject(MachineName, CLASS_SubObj) as ISubObj; end; procedure TSubObj.InitServerData; const CServerData: TServerData = ( ClassID: '{F57BF8DC-A3B4-4363-9049-4F058F3AE753}'; IntfIID: '{058E8DFF-0AD5-410A-B891-2C51818D2032}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TSubObj.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as ISubObj; end; end; procedure TSubObj.ConnectTo(svrIntf: ISubObj); begin Disconnect; FIntf := svrIntf; end; procedure TSubObj.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TSubObj.GetDefaultInterface: ISubObj; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation'); Result := FIntf; end; constructor TSubObj.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TSubObjProperties.Create(Self); {$ENDIF} end; destructor TSubObj.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TSubObj.GetServerProperties: TSubObjProperties; begin Result := FProps; end; {$ENDIF} {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TSubObjProperties.Create(AServer: TSubObj); begin inherited Create; FServer := AServer; end; function TSubObjProperties.GetDefaultInterface: ISubObj; begin Result := FServer.DefaultInterface; end; {$ENDIF} procedure Register; begin RegisterComponents('Servers',[TSubObj]); end; end.